package org.xin.framework.controller;

import cn.hutool.core.lang.Dict;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ：xin
 * @date ：Created in 2021/10/9
 * @desc <p>  </p>
 * @modified By：$
 * @version: $
 */
@Api(tags = "公共模块")
@CrossOrigin
@Controller
@RequestMapping("/")
public class IndexController {

    @Value("${server.servlet.context-path}")
    private String contextPath;

    @ApiOperation("获取URL")
    @GetMapping("")
    public void swagger(HttpServletResponse response) {
        try {
            response.sendRedirect(contextPath + "/doc.html#");

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
